package panel.newFunctionPreview
{
	import flash.display.Sprite;
	
	public class PointGroupList extends Sprite
	{
		private var pointList:Array;
		private var _pointRadius:int;
		
		public function PointGroupList(pointRadius:int = 0)
		{
			pointList = [];
			
			_pointRadius = pointRadius;
		}
		
		public function createPoint(list:Array,callBack:Function):void
		{
			if(pointList.length > list.length){
				for(var j:int = 0;j < pointList.length;j++){
					if(j > (list.length - 1)){
						this.removeChild(pointList[j]);
					}
				}
			}
			
			var wid:Number = 0;
			
			for(var i:int = 0;i < list.length;i++){
				if(pointList[i]){
					pointList[i].init();
				}else{
					var smallPoint:SmallPoint = new SmallPoint(_pointRadius);
					smallPoint.x = (smallPoint.width + 10) * i;
					this.addChild(smallPoint);
					
					pointList.push(smallPoint);
					
					wid = wid + (smallPoint.width + 10);
				}
			}
			
			this.width = wid;
			
			callBack();
		}
		
		public function changeData(current:int):void
		{
			for(var i:int = 0;i < pointList.length;i++){
				if(i != current){
					pointList[i].state = false;
				}else{
					pointList[i].state = true;
				}
			}
		}
		
		public function clear():void
		{
			pointList = [];
		}
	}
}